import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path"; // 注意修改这里

// https://vitejs.dev/config/
export default defineConfig({
  // ... 省略其他配置
  optimizeDeps: {
    // 开发时 解决这些commonjs包转成esm包
    include: [
      "@jiaminghi/c-render",
      "@jiaminghi/c-render/lib/plugin/util",
      "@jiaminghi/charts/lib/util/index",
      "@jiaminghi/charts/lib/util",
      "@jiaminghi/charts/lib/extend/index",
      "@jiaminghi/charts",
      "@jiaminghi/color",
    ],
  },
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve("./src"), // 注意修改这里
    },
  },
  server: {
    hmr: true,
    host: "0.0.0.0", // 绑定到所有网络接口
    port: 8080, // 可以根据需要更改端口
  },
});
